<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        class Person{
            name = "GG"
            sayHello = function(){
                console.log();
            } //添加方法的一种方式
            sayHello1(){
                console.log("GG"+this.name);
            }//添加方法(实力方法),实力方法中this就是当前实例
            static test(){
                console.log(this);
            }//静态方法(类方法)通过类来调用,静态方法中,this指向的是当前类
        }
        const p1 = new Person()
        console.log(p1);
        Person.test()
        p1.sayHello1()
    </script>
</head>
<body>
    
</body>
</html>